package com.cqndt.disaster.device.exception;

import com.cqndt.disaster.device.util.Result;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

@RestControllerAdvice
public class CommonExceptionHandler {

    @ExceptionHandler(RuntimeException.class)
    public Result exception(RuntimeException e) {
        e.printStackTrace();
        System.out.println("我报错了："+e.getLocalizedMessage());
        System.out.println("我报错了："+e.getCause());
        System.out.println("我报错了："+e.getSuppressed());
        System.out.println("我报错了："+e.getMessage());
        System.out.println("我报错了："+e.getStackTrace());
        return new Result().success(e.getMessage());
    }
    
}